/**
 * Created with IntelliJ IDEA.
 * User: User
 * Date: 06.04.13
 * Time: 16:47
 * To change this template use File | Settings | File Templates.
 */
public class NumberToRoman {
    public static void main(String[] args)
    {
        String [] RomArray;
        RomArray = new String[] {"I","IV", "V","IX", "X","XL", "L","XC", "C","CD", "D","CM", "M"};
        int[] NumArray = new int[] {1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000};
        int num=3753;
        String Roman = "";
        if ((0<num) &&(num<4000))
        {
            for (int i=NumArray.length-1;i>=0;i--)
            {
                if(num/NumArray[i]!=0)
                {
                    for(int j=0;j<num/NumArray[i];j++)
                    {
                        Roman+=RomArray[i];
                    }
                    num-=(num/NumArray[i])*NumArray[i];
                }
            }
            System.out.println(Roman);
        }
        else
            System.out.println("Число не из диапазона, не получится");
    }
}
